home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 2
/
Aminet AMIGA CDROM (1994)(Walnut Creek)[Feb 1994][W.O. 44790-1].iso
/
Aminet
/
misc
/
emu
/
z80emulator103.lzh
/
Interrupts.ASM
next >
Wrap
Assembly Source File
|
1992-06-23
|
2KB
|
54 lines
; Program to show clock interrupts of Z80 System
; Written for Z80 Emulator
; interrupt handling routine must reside at address 0008
; to correspond with RST 8 instruction for a clock interrupt in
; the Z80 system
; this interrupt service routine shows some typical aspects of
; Z80 interrupt programming:
; - the use of EXX to quickly make available an alternate register set
; without the overheads of stacking to main store
; - the use of B as a counter for a looping instruction
; - the use of C (the unused half of BC) to store the port address
INTERRUPT EQU 1000 ; define the start for the main routine
ORG #8
SERV_INT: EXX ; exchange register sets
LD HL,INT_MESS ; point to interrupt message
LD B,25 ; message length
LD C,1 ; port for output (console screen)
OTIR ; output the message
EXX ; get back our first set of registers
EI ; re-enable interrupts that were disabled
RETI ; return from interrupt service routine
; this following routine is a simple loop to continuously display a message
; we'll use an alternate format of the OUT instruction just to be different
ORG INTERRUPT
DISP_MESS:LD HL,STD_MESS ; point to standard message
LD B,20 ; message length
LOOP: LD A,(HL) ; get next character
OUT (1),A ; output character to console screen
INC HL ; point to next character
DJNZ LOOP ; repeat until all have been printed
LD A,R ; get value of refresh register
ADD A,32 ; offset to get normal ASCII character
OUT (1),A ; display this value
LD A,13 ; now define a carriage return
OUT (1),A ; and display it
JR DISP_MESS ; just continue forever
INT_MESS: DEFM **
DEFB 32
DEFM Servicing
DEFB 32
DEFM interrupt
DEFB 32
DEFM **
STD_MESS: DEFM Normal
DEFB 32
DEFM processing...